import java.util.ArrayList;
import java.util.List;

/**
 * .
 *
 * @author Xu Yayuan
 * @date 2021/11/3
 */
public class GNUtil {

    /**
     * 拼接全点名
     *
     * @param id 1,2,3,4,5,6
     * @return '1','2','3','4','5','6'
     */
    public static String FormarIDs(String id) {
        String[] gns = id.split(",");
        List<String> Tns = new ArrayList<String>();
        for (int i = 0, l = gns.length; i < l; i++) {
            if (!"".equals(gns[i])) {
                Tns.add(gns[i].toUpperCase());
            }
        }
        String gni = "";
        for (int i = 0, s = Tns.size(); i < s; i++) {
            gni += "'" + Tns.get(i) + "'";
            if (i < (s - 1)) {
                gni += ",";
            }
        }
        return gni;
    }


    /**
     * 拼接全点名
     *
     * @param gnName W3.GN01.ALARM1,W3.GN01.SCJP,W3.FAN3.POINT10,W3.GN01.XSCL,W3.GN01.LJYXSC,W3.GN01.LJCPSL
     * @return 'W3.GN01.ALARM1','W3.GN01.SCJP','W3.FAN3.POINT10','W3.GN01.XSCL','W3.GN01.LJYXSC','W3.GN01.LJCPSL'
     */
    public static String FormartGNs(String gnName) {
        String[] gns = gnName.split(",");
        List<String> Tns = new ArrayList<String>();
        for (int i = 0, l = gns.length; i < l; i++) {
            if (!"".equals(gns[i])) {
                Tns.add(gns[i].toUpperCase());
            }
        }
        String gni = "";
        for (int i = 0, s = Tns.size(); i < s; i++) {
            gni += "'" + Tns.get(i) + "'";
            if (i < (s - 1)) {
                gni += ",";
            }
        }
        return gni;
    }

    /**
     * @param gnName W3.GN01.ALARM1,W3.GN01.SCJP,W3.FAN3.POINT10,W3.GN01.XSCL,W3.GN01.LJYXSC,W3.GN01.LJCPSL
     * @return [W3.GN01.ALARM1, W3.GN01.SCJP, W3.FAN3.POINT10, W3.GN01.XSCL, W3.GN01.LJYXSC, W3.GN01.LJCPSL]
     */
    public static List<String> FormartGN(String gnName) {
        String[] gns = gnName.split(",");
        List<String> Gns = new ArrayList<String>();
        for (int i = 0, l = gns.length; i < l; i++) {
            if (!"".equals(gns[i])) {
                Gns.add(gns[i].toUpperCase());
            }
        }
        return Gns;
    }
}
